package libra.controller;

import java.util.Map;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Sentinel整合Gateway - API分组测试Controller
 */
@RestController
@RequestMapping("apiGroup")
public class ApiGroupController {
	String from = getClass().getSimpleName();
	
	// API分组，精确模式
	@RequestMapping("precise")
	public Object precise() {
		return Map.of("from", from, "method", "precise");
	}
	
	// API分组，前缀模式
	@RequestMapping("prefix")
	public Object prefix() {
		return Map.of("from", from, "method", "prefix");
	}
	// API分组，前缀模式
	@RequestMapping("prefix/1")
	public Object prefix_1() {
		return Map.of("from", from, "method", "prefix_1");
	}
	
	// API分组，正则模式
	@RequestMapping("regular")
	public Object regular() {
		return Map.of("from", from, "method", "regular");
	}
	// API分组，正则模式
	@RequestMapping("regular/{val}")
	public Object regular_rest( @PathVariable("val") String val ) {
		return Map.of("from", from, "method", "regular_rest", "val", val);
	}
	
}
